<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let arr =[1,2,3,4,5,6,6,6,6];
        let arr2 = [3,4,5,6,7,8,9];

        // 先去重,再做交集运算
        // let arr3 = [...new Set(arr)];
        // let arr4 = [...new Set(arr2)];

        // let  arr5 = arr3.filter(item=>arr4.includes(item));

        // console.log(arr5);


        // 交集 - 去重
        // filter
        // let  arr3 = arr.filter(function(item){
        //     // console.log(item);
        //     // return item === arr2[0]

        //     // console.log(arr2.includes(item));
        //     return arr2.includes(item);
        // });

        // let  arr3 = arr.filter(item=>arr2.includes(item));


        // //Set(4) {3, 4, 5, 6} => [3,4,5,6]
        // let arr4 = [...new Set(arr3)];  


        // console.log(arr4);


    </script>
</body>
</html>